package cqut.wys.kafka;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

/**
 * --------神兽出没--------/
 * ┌─┐     ┌─┐
 * ┌─┘─┴─────┘─┴─┐
 * │      ─      │
 * │  ┬─┘   └─┬  │
 * │             │
 * │      ┴      │  Code is far away from bug with the animal protecting
 * └───┐      ┌──┘  神兽保佑,代码无bug
 * │      │
 * │      └──────┐
 * │             ├┐
 * │             ┌┘
 * └┐ ┐ ┌───┬─┐ ┌┘
 * │ ┤ ┤   │ ┤ ┤
 * └─┴─┘   └─┴─┘
 * --------感觉萌萌哒--------/
 *
 * @author wuyoushan
 * @date 2018/7/5
 */
@Component
public class Producer {

    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    public void send(String message) {
        this.kafkaTemplate.send("test", message + "=" + System.currentTimeMillis());
        System.out.println("Sent sample message [" + message + "]");
    }

}
